import socket

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(("", 8080))
server_socket.listen(128)
client_socket, ip_port = server_socket.accept()
print("客户端连接", ip_port)
data = client_socket.recv(1024)
print(data.decode("gbk"))
client_socket.send("你好我是服务器".encode("gbk"))